<?php
namespace Home\Controller;
use Think\Controller;
/**
 * 设备管理控制器
 */


class DeviceController extends Controller{

	public function index(){
		
		
		$where['devicecode']=I('get.deviceid','','strip_tags');
		$shopid=M('device')->where($where)->getField("shopid");

		if(empty($shopid))
		{
			$result['status']=0;
			$result['msg']='该设备未绑定商家';
			echo json_encode($result,JSON_UNESCAPED_UNICODE);
		    return '';
		}
		$address=M('shop_user')->where("shopid='%d'",$shopid)->getField("address");
		if(empty($address))
		{
		   	$result['status']=2;
			$result['msg']='无法获取商家地址';
			echo json_encode($result,JSON_UNESCAPED_UNICODE);
		    return '';

		}
		  
		$result['status']=1;
		$result['address']=$address;
		echo json_encode($result,JSON_UNESCAPED_UNICODE);

		
		
		

	
}

}